<template>
  <div class="user container">
    <div class="topBox">
      <el-input size="medium" v-model="projectInfo" placeholder="请输入内容" class="topInput"></el-input>
      <el-button type="primary" size="medium" icon="el-icon-search">搜索</el-button>
      <!-- <el-button
        type="primary"
        size="medium"
        icon="el-icon-circle-plus-outline"
        @click="showDiag(1,'新增用户')"
      >新增用户</el-button>-->
    </div>
    <div class="contain">
      <el-table :data="userList" style="width:calc(100% - 10px);margin:auto;">
        <el-table-column prop="id" label="用户编号"></el-table-column>
        <el-table-column prop="name" label="姓名"></el-table-column>
        <el-table-column prop="performance" label="新签合同"></el-table-column>
        <el-table-column prop="achievement" label="当前到款"></el-table-column>
        <el-table-column prop="argument" label="论证编制"></el-table-column>
        <el-table-column prop="service" label="公共服务"></el-table-column>
        <el-table-column prop="research" label="科研成果"></el-table-column>
        <el-table-column prop="total" label="总计"></el-table-column>
      </el-table>
       <el-pagination
        background
        :page-size="pagination.size"
        :current-page="pagination.page"
        layout="pager"
        @current-change="currentChange"
        :page-count="pagination.total_page">
      </el-pagination>
    </div>

  </div>
</template>

<script>
  import {getUserIndex} from "@/api/api";

  export default {
    data() {
      return {
        userList: [],
        projectInfo: "",
        params: {
          page: 1,
          size: 10,
        },
        pagination: {
          page: 1,
          size: 10,
          total: 20,
          total_page: null,
        },
      };
    },
    created() {
      this.getUserInfoFn()
    },
    methods: {
      async getUserInfoFn() {
        let data = await getUserIndex(this.params);
        // this.userList = data.data.data;
        console.log(data);
        this.userList = data.data.data.list;
        this.pagination.total_page = data.data.data.total_page;
      },
      currentChange(page) {
        this.pagination.page = page;
        this.params.page = page;
        this.getUserInfoFn()
      }
    }
  };
</script>

<style lang="scss" scoped>
  .topBox {
    padding: 10px 0;
    width: calc(100% - 10px);
    margin: auto;
    border-bottom: solid 1px #e6e6e6;
    .topInput {
      width: 200px;
    }
  }
</style>
